﻿@model HanGu.Entity.MemberInfo
@{
    Layout = null;
    TempData["TitlePic"] = Model.PicPath;//.Replace("_B.", "_S.");
    TempData["ContorlID"] = "Introduction";
    TempData["Remark"] = Model.Introduction;
    TempData["GropName"] = Model.GUID;
    var SexList = ViewData["SexList"] as SelectList;
    var IsMarryList = ViewData["IsMarry"] as SelectList;
    var ProviceList = ViewData["Provice"] as SelectList;
    var CityList = ViewData["City"] as SelectList;
    var NativePlaceList = ViewData["NativePlace"] as SelectList;
    var JobList = ViewData["Job"] as SelectList;
    var JobSelected = new List<string>();
    if (Model.Job != null)
    {
        JobSelected.AddRange(Model.Job.Split(','));
    }
    var TradeList = ViewData["Trade"] as SelectList;
    var TradeSelected = new List<string>();
    if (Model.Trade != null)
    {
        TradeSelected.AddRange(Model.Trade.Split(','));
    }
    var Position = ViewData["Position"] as SelectList;
    var PositionSelected = new List<string>();
    if (Model.Position != null)
    {
        PositionSelected.AddRange(Model.Position.Split(','));
    } var InterestList = ViewData["Interest"] as SelectList;
    List<string> InterestArry = new List<string>();
    if (Model.Interest != null)
    { InterestArry.AddRange(Model.Interest.Split(',')); }
    var MemberGrade = ViewData["MemberGrade"] as SelectList;
    var Degree = ViewData["Degree"] as SelectList;
    var Oganization = ViewData["Oganization"] as SelectList;
    var Groups = ViewData["Groups"] as SelectList;

    var GroupsSelected = ViewData["MemberGroups"] as List<string> ?? new List<string>();
    var Parents = ViewData["Parents"] as SelectList;
    Model.MemberAssigneds = Model.MemberAssigneds ?? new List<HanGu.Entity.MemberAssigned>();
    var SelectedParents = Model.MemberAssigneds.Select(c => c.ManagerID.ToString()).ToList<string>();

    var ImportantLevels = ViewData["ImportantLevel"] as SelectList;
    var ChangeCharges = ViewData["ChangeCharge"] as List<HanGu.Entity.VChangeChargeRecorde>;//充值积分
    //var ChangeGrades = ViewData["ChangeGrade"] as List<HanGu.Entity.VChangeGradeRecorde>;//学位变更
    //var ChargeProducts = ViewData["ChargeProduct"] as List<HanGu.Entity.VChargeRecorde>;//兑换产品

    bool isQueryCharge = false;
    var CurentUser = Session["CurentUser"] as HanGu.Entity.CurrentUserDTO;
    isQueryCharge = CurentUser != null && CurentUser.Roles.SingleOrDefault(c => c.ID == "CustomerInfo_11") != null;


}
<div class="pageContent">
    <style>
        .mytable td
        {
            padding: 5px 5px 5px 5px;
        }
    </style>
    <form method="get" onsubmit="return navTabSearch(this);" id="@ViewData["CurrentController"]Form" action='/CustomerInfo/Default/Detail/@Model.ID?OpID=@ViewData["OperateID"]' >
    @Html.ValidationSummary(true)
    <div class="tabs" currentindex="0" eventtype="click">
        <div class="tabsHeader">
            <div class="tabsHeaderContent">
                <ul>
                    <li><a href="javascript:;"><span>客户基本信息</span></a></li>
                    <li><a href="/CustomerInfo/MemberChildren/index/@Model.ID?action=read" class="j-ajax">
                        <span>子女信息</span></a></li>
                    <li><a href="/CustomerInfo/MemberContract/index/@Model.ID?action=read" class="j-ajax">
                        <span>合同信息</span></a></li>
                    <li><a href="/CustomerInfo/MemberContact/index/@Model.ID?action=read" class="j-ajax">
                        <span>联系记录</span></a></li>
                    @if (isQueryCharge)
                    {
                        <li><a href="/CustomerInfo/ChangeChargeRecorde/index/@Model.ID?action=read" class="j-ajax">
                            <span>积分记录</span></a></li>
                    }
                    <li><a href="javascript:;"><span>用户记录</span></a></li>
                </ul>
            </div>
        </div>
        <div class="tabsContent">
            <div layouth="70">
                <div class="pageFormContent">
                    @Html.HiddenFor(model => model.ID)
                    @Html.HiddenFor(model => model.GUID)
                    @Html.HiddenFor(model => model.Pwd)
                    <div class="container">
                        @{
                            string ErrorForIsDirectly = TempData["ErrorForIsDirectly"] as string;
                            if (!string.IsNullOrEmpty(ErrorForIsDirectly))
                            {
                            <div class="title" style="color: Red; font-weight: bold">
                                @ErrorForIsDirectly</div>
                            }
                        }
                        <div class="title">
                            基本信息</div>
                        <div class="CreateDiv">
                            <div class="LeftDiv">
                                @*  <div>
                                    <label>
                                        标题图片：</label>
                                    <img id="preview" src="@Model.PicPath" width="200" height="200"/>
                                </div>*@
                                <p>
                                    <label>
                                        积分：</label>
                                    @Model.Charge
                                </p>
                                <p>
                                    <label>
                                        是否加入黑名单：</label>
                                    @Html.CheckBox("IsBacklist", Model.IsBacklist, new { disabled = "disabled" })
                                </p>
                                <p>
                                    <label>
                                        真实姓名：</label>
                                    @Model.RealName
                                </p>
                                <p>
                                    <label>
                                        性别：</label>
                                    @{
                                        var sexModel = SexList.SingleOrDefault(c => c.Value == Model.Sex);
                                        if (sexModel != null)
                                        {
                                        @sexModel.Text
                                        }
                                    }
                                </p>
                                <p>
                                    <label>
                                        生日：</label>
                                    <span formatdate="yyyy-MM-dd">@Model.Birthday</span>
                                </p>
                                <p>
                                    <label>
                                        婚姻状况：</label>
                                    @{
                                        var marryModel = IsMarryList.SingleOrDefault(c => c.Value == Model.IsMarry);
                                        if (marryModel != null)
                                        {
                                        @marryModel.Text
                                        }
                                    }
                                </p>
                                <p>
                                    <label>
                                        证件号码：</label>
                                    @Model.CredentialNum
                                </p>
                                <p>
                                    <label>
                                        所在城市：</label>
                                    @{
                                        var modelProvice = ProviceList.SingleOrDefault(c => c.Value == Model.Provice);
                                        if (modelProvice != null)
                                        {
                                        @modelProvice.Text
                                        }
                                
                                    }
                                    &nbsp;&nbsp;
                                    @{
                                        var modelCity = CityList.SingleOrDefault(c => c.Value == Model.City);
                                        if (modelCity != null)
                                        {
                                        @modelCity.Text
                                        }
                                    }
                                </p>
                                <p>
                                    <label>
                                        通讯地址：</label>
                                    @Model.Address
                                </p>
                                <p>
                                    <label>
                                        邮编：</label>
                                    @Model.Zip
                                </p>
                                <p>
                                    <label>
                                        籍贯：</label>
                                    @{
                                        var modelNativePlace = NativePlaceList.SingleOrDefault(c => c.Value == Model.NativePlace);
                                        if (modelNativePlace != null)
                                        {
                                        @modelNativePlace.Text
                                        }
                                    }
                                </p>
                            </div>
                            <div class="rightDiv">
                                 <div style="height:100%">
                                    <label>
                                        所属行业：</label>
                                    <table class="mytable">
                                        <tr>
                                            @{int j = 1;}
                                            @foreach (var item in TradeList.Where(c => TradeSelected.Contains(c.Value)))
                                            {
                                                <td nowarp="nowarp">
                                                    @if (TradeSelected.Contains(item.Value))
                                                    {
                                                        @item.Text
                                                        if (j % 2 == 0)
                                                        { 
                                                        @MvcHtmlString.Create("</tr><tr>")
                                                        }
                                                        j += 1;

                                                    }
                                                </td>
                                            }
                                        </tr>
                                    </table>
                                    @Html.ValidationMessageFor(model => model.Trade)
                                </div>
                                <div class="divider">
                                </div>
                                <p style="width: 500px; height: 100%">
                                    <label for="Oganization">
                                        所属于组织：</label>
                                    @*  <label style="padding-left:0;">
                                @Html.DropDownListFor(model => model.Oganization, Oganization, new { @class = "EditSelect", name = "Oganization" })</label> *@
                                    @Html.TextBoxFor(model => model.Oganization, new { @Class = "AutoComplete" })
                                    @Html.ValidationMessageFor(model => model.Oganization)
                                </p>
                                <div class="divider">
                                </div>
                                <div style="height:100%">
                                    <label>
                                        职位：</label>
                                    <table class="mytable">
                                        <tr>
                                            @{ j = 1;}
                                            @foreach (var item in Position.Where(c => PositionSelected.Contains(c.Value)))
                                            {
                                                if (PositionSelected.Contains(item.Value))
                                                {
                                                <td nowarp="nowarp">
                                                    @item.Text
                                                    @if (j % 2 == 0)
                                                    { 
                                                        @MvcHtmlString.Create("</tr><tr>")
                                                    }
                                                    @{j += 1;}
                                                </td> }
                                            }
                                        </tr>
                                    </table>
                                    @Html.ValidationMessageFor(model => model.Position)
                                </div>
                                <div class="divider">
                                </div>
                                <div style="height:100%">
                                    <label>
                                        职业：</label>
                                    <table class="mytable">
                                        <tr>
                                            @{ j = 1;}
                                            @foreach (var item in JobList.Where(c => JobSelected.Contains(c.Value)))
                                            {
                                                <td nowarp="nowarp">
                                                    @if (JobSelected.Contains(item.Value))
                                                    {
                                                        @item.Text
                                                        if (j % 2 == 0)
                                                        { 
                                                        @MvcHtmlString.Create("</tr><tr>")
                                                        }
                                                        j += 1;
                                                    }
                                                </td>
                                            }
                                        </tr>
                                    </table>
                                    @Html.ValidationMessageFor(model => model.Job)
                                </div>
                                <div class="divider">
                                </div>
                                <div style="height:100%">
                                    <label>
                                        兴趣点：</label>
                                    <table class="mytable">
                                        <tr>
                                            @{ j = 1;}
                                            @foreach (var item in InterestList.Where(c=>InterestArry.Contains(c.Value)))
                                            {
                                                <td nowarp="nowarp">
                                                    @if (InterestArry.Contains(item.Value))
                                                    {
                                                        @item.Text
                                                        if (j % 2 == 0)
                                                        { 
                                                        @MvcHtmlString.Create("</tr><tr>")
                                                        }
                                                        j += 1;
                                                    }
                                                </td>
                                            }
                                        </tr>
                                    </table>
                                    @Html.ValidationMessageFor(model => model.Interest)
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="container">
                        <div class="title">
                            允许联系方式</div>
                        <div class="CreateDiv">
                            <div class="LeftDiv">
                                <p>
                                    <label>
                                        手机：</label>
                                    @Model.Tel
                                </p>
                                <p>
                                    <label>
                                        联系电话：</label>
                                    @Model.Telephone
                                </p>
                                <p>
                                    <label>
                                        是否电话联系：</label>
                                    @Html.CheckBox("NoTel", Model.NoTel, new { disabled = "disabled" })
                                </p>
                                <p>
                                    <label>
                                        是否接收短信：</label>
                                    @Html.CheckBox("NoSMS", Model.NoSMS, new { disabled = "disabled" })
                                </p>
                            </div>
                            <div class="rightDiv">
                                <p>
                                    <label>
                                        邮箱：</label>
                                    @Model.Email
                                    @Html.ValidationMessageFor(model => model.Email)
                                </p>
                                <p>
                                    <label>
                                        是否接收邮件：</label>
                                    @Html.CheckBox("NoEmail", Model.NoEmail, new { disabled = "disabled" })
                                </p>
                                <p>
                                    <label>
                                        即时联系方式：</label>
                                    @Model.QLink
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="container">
                        <div class="title">
                            等级信息</div>
                        <div class="CreateDiv">
                            <div class="LeftDiv">
                                <p>
                                    <label>
                                        学位：</label>
                                    @{
                                        var modelDegree = Degree.SingleOrDefault(c => c.Value == Model.Degree);
                                        if (modelDegree != null)
                                        {
                                        @modelDegree.Text
                                        }                                  }
                                </p>
                                <p>
                                    <label>
                                        级别：</label>
                                    @{
                                        var modelGrade = MemberGrade.SingleOrDefault(c => c.Value == Model.Grade);
                                        if (modelGrade != null)
                                        { 
                                        @modelGrade.Text;
                                        }
                                    }
                                </p>
                            </div>
                            <div class="rightDiv">
                                <p>
                                    <label>
                                        重要级别：</label>
                                    @{
                                        var importantLevel = ImportantLevels.SingleOrDefault(c => c.Value == Model.ImportantLevel);
                                        if (importantLevel != null)
                                        { 
                                        @importantLevel.Text;
                                        }
                                    }
                                </p>
                                @* <p>
                                    <label>
                                        是否直属：</label>
                                    @Html.CheckBox("IsDirectly", Model.IsDirectly, new { disabled = "disabled" })
                                </p>*@
                            </div>
                        </div>
                    </div>
                    <div>
                        <p style="width: 100%">
                            <label>
                                群：</label>
                            @{
                                var group = Groups.SingleOrDefault(c => c.Value == Model.GroupID);
                                if (group != null)
                                {
                                @group.Text
                                }
                            }
                            @foreach (var item in Groups)
                            {

                                if (GroupsSelected.Contains(item.Value))
                                {
                                @item.Text;
                                }

                            }
                        </p>
                    </div>
                    <div>
                        <label>
                            归属用户：</label>
                        @foreach (var item in Parents)
                        {

                            if (SelectedParents.Contains(item.Value))
                            {
                            <label style="width: auto; white-space: nowrap; padding-right: 5px">
                                @item.Text
                            </label>
                            }

                        }
                    </div>
                    <div class="divider">
                    </div>
                    <div>
                        <p>
                            <label>
                                创建时间：</label>
                            @Model.CreateTime
                        </p>
                        <p>
                            <label>
                                创建者：</label>
                            @Model.Creator
                        </p>
                        <p>
                            <label>
                                修改时间：</label>
                            @Model.UpdateTime
                        </p>
                        <p>
                            <label>
                                修改者：</label>
                            @Model.Updater
                        </p>
                    </div>
                    <div>
                        <p style="width: 100%;">
                            <label>
                                简介：</label>
                            @Model.Introduction
                        </p>
                    </div>
                </div>
            </div>
            <div layouth="70">
            </div>
            <div layouth="70">
            </div>
            <div layouth="70">
            </div>
            @*<div layouth="70">
                <table class="list" width="100%">
                    @{i = 1;}
                    @foreach (var item in ChargeProducts)
                    {
                        <tr>
                            <td>
                                @i
                            </td>
                            <td>
                                <span formatdate="yyyy年MM月dd日 hh时mm分">@item.ChangeTime</span>
                            </td>
                            <td style="padding-left: 5px; padding-right: 5px">
                                <span>兑换积分</span>
                            </td>
                            <td style="text-align: right;">@item.ChangeValue.ToString("D")
                            </td>
                            <td>
                                &nbsp;<img src="/Content/images/money.png" />
                            </td>
                        </tr>
                        i += 1;
                    }
                </table>
            </div>*@
            @if (isQueryCharge)
            {
                <div layouth="70">
                </div>
            }
            <div layouth="70">
                <table class="list" width="100%">
                    <thead>
                        <tr>
                            <th>
                                序号
                            </th>
                            <th>
                                用户名
                            </th>
                            <th>
                                时间
                            </th>
                        </tr>
                    </thead>
                    @{var i = 1;
                      Model.MemberAssignedHis = Model.MemberAssignedHis ?? new List<HanGu.Entity.vwMemberAssignedHis>();
                    }
                    @foreach (var item in Model.MemberAssignedHis)
                    {
                        <tr>
                            <td>
                                @i
                            </td>
                            <td>
                                @item.ManagerName@item.User
                            </td>
                            <td>
                                <span formatdate="yyyy-MM-dd HH:mm">@item.CreateDate</span>
                            </td>
                        </tr>
                        i += 1;
                    }
                </table>
            </div>
        </div>
    </div>
    @* <div class="formBar">
        <ul>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">
                            编辑</button></div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button type="button" class="close">
                            取消</button></div>
                </div>
            </li>
        </ul>
    </div>*@
    </form>
</div>
